export module database;

import <vector>;
import <string>;

import employee;


namespace Records
{
	const int FirstEmployeeNumber{ 1'000 };

	export class Database
	{
	public:
		Employee &addEmployee(const std::string &firstName, const std::string &lastName);

		Employee &getEmployee(int employeeNumber);

		Employee &getEmployee(const std::string &firstName, const std::string &lastName);

		void displayAll() const;
		void displayCurrent() const;
		void displayFormer() const;

	private:
		std::vector<Employee> m_employees;
		int m_nextEmployeeNumber{ FirstEmployeeNumber };
	};


	export void testDatabase()
	{
		Database db;
		Employee &emp1{ db.addEmployee("Greg", "Wallis") };
		emp1.fire();

		Employee &emp2{ db.addEmployee("Marc", "White") };
		emp2.setSalary(100'000);

		Employee &emp3{ db.addEmployee("John", "Doe") };
		emp3.setSalary(10'000);
		emp3.promote();

		std::cout << "All employees:" << std::endl << std::endl;;
		db.displayAll();

		std::cout << std::endl << "Current employees: " << std::endl << std::endl;
		db.displayCurrent();

		std::cout << std::endl << "Former employees: " << std::endl << std::endl;
		db.displayFormer();
	}

}